package org.example.test.mapper;

import org.apache.ibatis.annotations.*;
import org.example.test.entity.Emp;

import java.util.List;

@Mapper
public interface EmpMapper {
    @Select("SELECT * FROM test.emp where ename like  '%${ename}%'")
    List<Emp> findAll( String ename);

    @Delete("delete from test.emp where empno = #{empno}")
    int delete(Integer empno);
    @Update("update emp set empno = #{empno},"+
            "ename=#{ename},"+
            "job=#{job},"+
            "mgr=#{mgr},"+
            "hiredate=#{hiredate},"+
            "sal=#{sal},"+
            "comm=#{comm},"+
            "deptno=#{deptno} "+
            "where empno=#{empno}")
    int editEmp(Emp emp);
@Insert("INSERT into test.emp(empno,ename,job,mgr,hiredate,sal,comm)VALUES" +
        "(#{empno},#{ename},#{job},#{mgr},#{hiredate},#{sal},#{comm})")
    int addEmp(Emp emp);
}
